//
//  ZCTool.h
//  UniversalApp
//
//  Created by 凯朱 on 2019/5/30.
//  Copyright © 2019 徐阳. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "MBProgressHUD.h"
NS_ASSUME_NONNULL_BEGIN

@interface ZCTool : NSObject
/**
 window上展示toast提示
 
 @param message 提示文案
 */
+(void)showToastOnKeyWindowWith:(NSString *)message;

/**
 字典或数组转字符串  代替方法  +(NSString *)systemUtilsDataToJson:(id)dicOrArr
 
 @param dicOrArr 字典或数组对象
 @return json字符串
 */
+(NSString *)objectToJson:(id)dicOrArr;

/**
 json字符串转字典 - 有校验(解析失败或格式错误返回空字典)
 
 @param jsonStr json字符串
 @return 字典
 */
+(NSDictionary *)dictionaryWithJsonStr:(NSString *)jsonStr;

/**
 json字符串转数组 - 有校验(解析失败或格式错误返回空字典)
 
 @param jsonStr json字符串
 @return 数组
 */
+(NSArray *)arrayWithJsonStr:(NSString *)jsonStr;

/**
 处理图片并且保存资源到本地 - 保存的为相对路径
 
 @param image 图片
 @return 图片文件名 - 相对路径
 */
+(NSString *)saveImageToLocalWithImage:(UIImage *)image;

/**
 获取完整的文件路径名 - 绝对路径
 
 @param fileName 文件名
 */
+(NSString *)getFullFilePathWithFileName:(NSString *)fileName;

#pragma mark -
#pragma mark - ================<loading图>===============
+(void)showHudOnKeyWindow;
+(MBProgressHUD *)showHudOnKeyWindowWith:(NSString *)message;
+(void)showHudOnView:(UIView *)view;
+(MBProgressHUD *)showHudOnView:(UIView *)view message:(NSString *)message;
+(void)hideHudOnView:(UIView *)view;
+(void)hideHudOnKeyWindow;
+(void)showDefaultImageOnView:(UIView *)view;
+(void)showDefaultImageOnView:(UIView *)view message:(NSString *)message;
+(void)hideDefaultImageOnView:(UIView *)view;
+(UIImage *)getBgImage;
+(UIImage *)getJudgBgImage;
+(UIImage *)getScoreBgImage;
+(void)screenShotsAndSaveComplete:(void(^)(UIImage * img)) complete;
+(void)screenShotsComplete:(void(^)(UIImage * img)) complete;
//调用系统分享
+(void)shareWithTitle:(NSString *)title vc:(UIViewController *)vc;
//调用系统分享文件
+(void)shareWithTitle:(NSString *)title filePath:(NSString *)filePath vc:(UIViewController *)vc;
//调用系统分享url
+(void)shareWithTitle:(NSString *)title httpUrl:(NSString *)httpUrl vc:(UIViewController *)vc;
/*获取当前视图的VC层*/
+(UIViewController *)getCurrentUIVC;
+(BOOL)isFullScreenIphone;
+(NSString *)locaStrWith:(NSString *)str;
+(NSString *)getLang;
+(BOOL)isOpenDebugModel;
+(void)showLoadingWith:(NSString *)message view:(UIView *)view;
+(void)hideLoading:(UIView *)view;
+(void)showLoadingOnKeyWindow;
+(void)showLoadingOnKeyWindowWith:(NSString *)message;
+(void)updateLoadingOnKeyWindowWith:(NSString *)message;
+(void)hideLoadingOnKeyWindow;
+(void)showLoadingOnKeyWindowWith:(NSString *)message hideTime:(NSInteger)hideTime;
+(void)showAwakeTipAlert:(void(^)(void))click;
//自动连接上设备
+(void)connectDeviceWith:(SLLockModel *)model toast:(NSString *)toast finish:(void(^)(BOOL isSuccess))finish;
//自动连接上设备 - 后台进行无感知
+(void)connectDeviceBackgroundWith:(SLLockModel *)model finish:(void(^)(BOOL isSuccess))finish;

+(NSString *)getCurDateStr;

+(NSString *)getDateStrWith:(NSString *)timeInterval;

+(void)showShareAlertView:(NSString *)keyId;
+(BOOL)checkNetWork;
//添加蓝牙钥匙
+(void)uploadBlueToothKeyData:(SLLockKeyModel *)keyModel;
+(BOOL)checkGuestTime;
//固件版本升级检测
+(void)checkUpdateInfo:(NSString *)curFirmVersion finish:(void(^)(BOOL needUpdate, id updateInfo))finish;

+(void)getFileSizeWidthUrl:(NSString *)url finish:(void(^)(NSString *size))finish;

+(NSString *)temperatureWith:(NSString *)level;

+(void)showLocalNotfyAlertWith:(NSString *)title body:(NSString *)body;

+(void)batchSyncDeviceKeyDatas:(void(^)(BOOL isSuccess,NSString *message))finish;
//批量同步开锁日志数据
+(void)batchSyncDeviceOpenLogDatas:(void(^)(BOOL isSuccess,NSString *message))finish;

+(NSString *)updateTimeWith:(NSString *)sysncTime;
+(NSArray *)warnStrWith:(NSInteger)warnType;
//开锁逻辑封装
+(void)openLockAction:(void(^)(BOOL isSuccess,NSString *message))finish;
//只发送开锁指令
+(void)sendOpenLockSegment:(void(^)(BOOL isSuccess,NSString *message))finish;
//远程开锁逻辑封装
+(void)remoteOpenLockAction:(void(^)(BOOL isSuccess,NSString *message))finish;
+(NSString *)commonDateFormart;
@end

NS_ASSUME_NONNULL_END
